'Count number of lines
'Utility to count the total number of lines in a text file
'by Dave Navarro, Jr.
  $STRING 32
  DEFINT A-Z
  Filename$ = UCASE$(COMMAND$)
   IF DIR$(Filename$) = "" THEN
      PRINT Filename$; " not found!"
      END 1
   END IF
   OPEN Filename$ FOR BINARY AS #1
    WHILE NOT EOF(1)
     GET$ #1, 32750, Temp$
     Lines% = Lines% + TALLY(Temp$, CHR$(13,10))  ' count the carriage                                                                   								   ' return/line feed pairs
     IF NOT EOF(1) THEN
       SEEK #1, SEEK(1) - 1   	     ' compensate for a CR by itself at 
                              	     ' the end of the block
     END IF
    WEND
   CLOSE
PRINT "Found"; Lines%+1; "lines in "; Filename$

